




package com.mapper;

import com.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
//    @Insert("INSERT INTO t_user (user_name, pwd) VALUES (#{userName}, #{pwd})")
//    void addUser(User user);
//
//    @Select("SELECT * FROM t_user WHERE id = #{id}")
//    User queryUserById(Integer id);
//
////    修改
//    @Update("UPDATE t_user SET user_name = #{userName}, pwd = #{pwd} WHERE id = #{id}")
//    int updateUser(User user);
    @Select("SELECT * FROM t_user WHERE id = #{id}")
    public User findById(Integer id);

    @Insert("INSERT INTO t_user(user_name,pwd,email) values (#{userName},#{pwd},#{email})")
    public int insertUser(User user);

    @Select("SELECT * FROM t_user WHERE user_name=#{userName} and pwd=#{pwd}")
    public User userLogin(User user);
}
